import watermark from '../../../common/watermark.js';

(function (window, document, $) {
    $(function () {
        $('body').attr('data-weui-theme', 'light'); //强制光明模式

        _initCommand();
        _returnMain(); // 返回首页
        _watermarkBgImg(); // 添加水印信息
    });

    //TODO : 命名初始化
    const _initCommand = () => {
        // 人员入厂
        $('#addPerInPlan').on('click', function (e) {
            window.sessionStorage.removeItem('getReceveEntry');
            window.sessionStorage.removeItem('deliverDatas');
            window.sessionStorage.removeItem('ids');
            location.href = `../inboundplan/addperinplan.html?v=${Utils.GetTime()}`;
        });

        // 其他车辆入厂
        $('#addCarInPlan').on('click', function (e) {
            window.sessionStorage.removeItem('getReceveEntry');
            window.sessionStorage.removeItem('deliverDatas');
            window.sessionStorage.removeItem('ids');
            location.href = `../inboundplan/addothercarplan.html?v=${Utils.GetTime()}`;
        });
    };

    //返回首页
    const _returnMain = () => {
        $('#returnMain').on('click', function () {
            location.href = '../../main.html';
        });
    };

    // 添加水印信息
    const _watermarkBgImg = () => {
        let _userInfo = JSON.parse(Utils.GetSessionStorage('SNAccountEply')) || {};
        watermark.set(_userInfo.name + _userInfo.numCode); // 水印
    };
})(window, document, jQuery);
